﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using JM.JCY.BusinessEntity.PPSM2007;
using JM.JCY.Proxy;
using Microsoft.SharePoint;
using JM.JCY.BusinessEntity;
using System.Linq;
using System.Data;
using JM.JCY.Common;

namespace JM.JCY.SharePointComponent.SystemIntegration.SystemIntegrationOne
{
    public partial class SystemIntegrationOneUserControl : UserControl
    {
        PPSM2007CodeDataSet.T_PPSM2007CODEDataTable CodeTable;
        int ID = 1;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

            }
        }

        #region 执法档



        #endregion

        #region 廉政档



        #endregion

        #region 绩效档



        #endregion

        #region 个况档

        public PPSMUserInfoDataSet.UserInfoDataTable GetUserInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetUserInfoByName(userName);
            }
        }
        public PPSMUserInfoDataSet.UserCareerDataTable GetCareerByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetCareerByName(userName);
            }
        }

        public PPSMUserEduInfoDataSet.UserEduInfoDataTable GetEduInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetEduInfoByName(userName);
            }
        }

        public PPSMUserEduInfoDataSet.UserTrainDataTable GetTrainInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetTrainInfoByName(userName);
            }
        }

        public PPSMUserRelationDataSet.UserRelationDataTable GetRelationInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetRelationInfoByName(userName);
            }
        }
        public PPSMUserAssessmentDataSet.UserAssessmentDataTable GetAssessmentInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GeAssessmentInfoByName(userName);
            }
        }

        public PPSMUserAssessmentDataSet.UserGloryDataTable GetAwardInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GeGloryInfoByName(userName);
            }
        }
        public PPSMUserAssessmentDataSet.UserPunishInfoDataTable GetPunishInfoByName(string userName)
        {
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetPunishInfoByName(userName);
            }
        }

        public PPSM2007CodeDataSet.T_PPSM2007CODEDataTable GetPPSM2007CODEData()
        {
            var dt = new PPSM2007CodeDataSet.T_PPSM2007CODEDataTable();
            using (PPSM2007Proxy proxy = new PPSM2007Proxy())
            {
                return proxy.GetPPSM2007CodeTable();
            }
        }
        public string GetCodeDescByCategoryAndValue(PPSM2007CodeDataSet.T_PPSM2007CODEDataTable dt, string category, string value)
        {
            try
            {
                var codeDesc = from codeTable in dt
                               where codeTable.Category == category && codeTable.CodeValue == value
                               select codeTable.CodeDesc;
                return codeDesc.First();
            }
            catch (Exception)
            {

                return "";
            }

        }

        protected void dlJob_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            PPSMUserInfoDataSet.UserCareerRow row = (PPSMUserInfoDataSet.UserCareerRow)e.Item.DataItem;
            Label lbID = (Label)e.Item.FindControl("lbID");
            Label lbStartDateTime = (Label)e.Item.FindControl("lbStartDateTime");
            Label lbEndDateTime = (Label)e.Item.FindControl("lbEndDateTime");
            Label lbJobAndPost = (Label)e.Item.FindControl("lbJobAndPost");
            Label lbAdministrativeGrade2 = (Label)e.Item.FindControl("lbAdministrativeGrade2");
            lbID.Text = Convert.ToString(e.Item.ItemIndex + 1);
            lbStartDateTime.Text = string.IsNullOrEmpty(row.BeginDate) ? string.Empty : row.BeginDate.Substring(0, 4).ToString() + "年" + row.BeginDate.Substring(4, 2).ToString() + "月" + row.BeginDate.Substring(6, 2).ToString() + "日";
            lbEndDateTime.Text = string.IsNullOrEmpty(row.EndDate) ? string.Empty : row.EndDate.Substring(0, 4).ToString() + "年" + row.EndDate.Substring(4, 2).ToString() + "月" + row.EndDate.Substring(6, 2).ToString() + "日";
            lbJobAndPost.Text = string.IsNullOrEmpty(row.UserCareer) ? string.Empty : row.UserCareer;
            lbAdministrativeGrade2.Text = string.IsNullOrEmpty(row.AdminRank) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "行政职级", row.AdminRank);
            ID++;
        }

        protected void dlYearAssessment_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            PPSMUserAssessmentDataSet.UserAssessmentRow row = (PPSMUserAssessmentDataSet.UserAssessmentRow)e.Item.DataItem;
            Label lbYearAssessment = (Label)e.Item.FindControl("lbYearAssessment");
            Label lbAssessmentResult = (Label)e.Item.FindControl("lbAssessmentResult");
            lbYearAssessment.Text = string.IsNullOrEmpty(row.UserTestTime) ? string.Empty : row.UserTestTime;
            lbAssessmentResult.Text = string.IsNullOrEmpty(row.UserTestLevel) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "考核情况", row.UserTestLevel);

        }

        protected void dlSocialRelation_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            PPSMUserRelationDataSet.UserRelationRow row = (PPSMUserRelationDataSet.UserRelationRow)e.Item.DataItem;
            Label lbID = (Label)e.Item.FindControl("lbID");
            Label lbName = (Label)e.Item.FindControl("lbName");
            Label lbRelationName = (Label)e.Item.FindControl("lbRelationName");
            Label lbBirth = (Label)e.Item.FindControl("lbBirth");
            Label lbWorkPlace = (Label)e.Item.FindControl("lbWorkPlace");
            Label lbJobTitle = (Label)e.Item.FindControl("lbJobTitle");
            Label lbPoliticalLandscape = (Label)e.Item.FindControl("lbPoliticalLandscape");
            lbID.Text = Convert.ToString(e.Item.ItemIndex + 1);
            ID++;
            lbName.Text = string.IsNullOrEmpty(row.RelationName) ? string.Empty : row.RelationName;
            lbRelationName.Text = string.IsNullOrEmpty(row.UserRelation) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "关系称谓", row.UserRelation);
            lbBirth.Text = string.IsNullOrEmpty(row.Birthday) ? string.Empty : row.Birthday.Substring(0, 4).ToString() + "年";
            lbWorkPlace.Text = string.IsNullOrEmpty(row.WorkDept) ? string.Empty : row.WorkDept;
            lbJobTitle.Text = string.IsNullOrEmpty(row.AdminRank) ? string.Empty : row.AdminRank;
            lbPoliticalLandscape.Text = string.IsNullOrEmpty(row.Clan) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "政治面貌", row.Clan);

        }

        protected void dlEduction_ItemDataBound(object sender, DataListItemEventArgs e)
        {

            PPSMUserEduInfoDataSet.UserEduInfoRow row = (PPSMUserEduInfoDataSet.UserEduInfoRow)e.Item.DataItem;
            Label lbEducationType = (Label)e.Item.FindControl("lbEducationType");
            Label lbSchoolName = (Label)e.Item.FindControl("lbSchoolName");
            Label lbProfessionalName = (Label)e.Item.FindControl("lbProfessionalName");
            Label lbNationalEducationType = (Label)e.Item.FindControl("lbNationalEducationType");
            Label lbNationalEducationalBackground = (Label)e.Item.FindControl("lbNationalEducationalBackground");
            Label lbNationalEducationalLevel = (Label)e.Item.FindControl("lbNationalEducationalLevel");
            Label lbPartyEducationalBackground = (Label)e.Item.FindControl("lbPartyEducationalBackground");
            lbEducationType.Text = string.IsNullOrEmpty(row.UserEduArea) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "教育类型", row.UserEduArea);
            lbSchoolName.Text = string.IsNullOrEmpty(row.UserUniversityName) ? string.Empty : row.UserUniversityName;
            lbProfessionalName.Text = string.IsNullOrEmpty(row.UserSpecialtyName) ? string.Empty : row.UserSpecialtyName;
            lbNationalEducationType.Text = string.IsNullOrEmpty(row.EducationSort) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "国民教育类别", row.EducationSort);
            lbNationalEducationalBackground.Text = string.IsNullOrEmpty(row.UserGraduate) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "国民教育学历", row.UserGraduate);
            lbNationalEducationalLevel.Text = string.IsNullOrEmpty(row.UserDegree) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "国民教育学位", row.UserDegree);
            lbPartyEducationalBackground.Text = string.IsNullOrEmpty(row.UserPartyGraduate) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "党校学历", row.UserPartyGraduate);
        }

        protected void dlTrainingRecord_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            PPSMUserEduInfoDataSet.UserTrainRow row = (PPSMUserEduInfoDataSet.UserTrainRow)e.Item.DataItem;
            Label lbStartDateTime = (Label)e.Item.FindControl("lbStartDateTime");
            Label lbEndDateTime = (Label)e.Item.FindControl("lbEndDateTime");
            Label lbTrainingType = (Label)e.Item.FindControl("lbTrainingType");
            Label lbTrainingContent = (Label)e.Item.FindControl("lbTrainingContent");
            Label lbTrainingPlace = (Label)e.Item.FindControl("lbTrainingPlace");
            lbStartDateTime.Text = string.IsNullOrEmpty(row.TrainBeginDate) ? string.Empty : row.TrainBeginDate.Substring(0, 4).ToString() + "年" + row.TrainBeginDate.Substring(4, 2).ToString() + "月" + row.TrainBeginDate.Substring(6, 2).ToString() + "日";
            lbEndDateTime.Text = string.IsNullOrEmpty(row.TrainEndDate) ? string.Empty : row.TrainEndDate.Substring(0, 4).ToString() + "年" + row.TrainEndDate.Substring(4, 2).ToString() + "月" + row.TrainEndDate.Substring(6, 2).ToString() + "日";
            lbTrainingType.Text = string.IsNullOrEmpty(row.TrainSort) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "培训类别", row.TrainSort);
            if (row.TrainSort == "50" || row.TrainSort == "90")
            {
                lbTrainingContent.Text = string.IsNullOrEmpty(row.TrainMatter) ? string.Empty : row.TrainMatter;
            }
            else
            {
                lbTrainingContent.Text = string.IsNullOrEmpty(row.TrainMatter) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "培训内容", row.TrainMatter);
            }
            lbTrainingPlace.Text = string.IsNullOrEmpty(row.TrainLevel) ? string.Empty : GetCodeDescByCategoryAndValue(CodeTable, "培训机构", row.TrainLevel);

        }

        private static SPListItemCollection GetPropertyInfoList(string userName)
        {
            string listName = "财产情况";
            SPWeb myWeb = SPContext.Current.Web;
            SPList PropertyInfoList = myWeb.Lists[listName];
            SPQuery query = new SPQuery();
            query.Query = @"<Where>
            <Eq>
            <FieldRef Name='Title'/>
            <Value Type='Text'>" + userName + @"</ValueType>
            </Eq>
            </Where>";
            SPListItemCollection spItem = PropertyInfoList.GetItems(query);
            return spItem;
        }

        protected void dlPropertyInfo_ItemDataBound(object sender, DataListItemEventArgs e)
        {

            DataRow row = (DataRow)e.Item.DataItem;

            Label lbName = (Label)e.Item.FindControl("lbName");
            Label lbCreateTime = (Label)e.Item.FindControl("lbCreateTime");
            Label lbIncome = (Label)e.Item.FindControl("lbIncome");
            Label lbHouse = (Label)e.Item.FindControl("lbHouse");
            Label lbCar = (Label)e.Item.FindControl("lbCar");

            lbName.Text = row["UserName"].ToString();
            lbIncome.Text = row["Income"].ToString();
            lbHouse.Text = row["House"].ToString();
            lbCreateTime.Text = row["CreateTime"].ToString();
            lbCar.Text = row["Car"].ToString();

        }

        #endregion

        #region GrdiView DataBound

        #region 执法档

        //涉案款物处理情况
        protected void gvLawCaseMaterial_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

            }

        }

        //安全办案基本情况
        protected void gvLawCaseSafety_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[4].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }
        #endregion

        #region 廉政档

        //《廉政准则》和《廉洁从检若干规定》对照检查表
        protected void gvLianjieLianZhengCheck_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblSignDate = (Label)e.Row.Cells[1].FindControl("lblSignDate");

                string dateString = lblSignDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblSignDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //内部监督有关事项自查表（业务部门）
        protected void gvSelfControlBusiness_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[3].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //内部监督有关事项自查表（综合部门）
        protected void gvSelfControlOverall_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[3].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //党员干部举办婚丧喜庆宴席审批表
        protected void gvStaffWedding_DataBound(object sender, GridViewRowEventArgs e)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblApplicationtDate = (Label)e.Row.Cells[2].FindControl("lblApplicationtDate");

                string dateString = lblApplicationtDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblApplicationtDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);

                LinkButton lbNumber = (LinkButton)e.Row.Cells[0].FindControl("lbNumber");
                lbNumber.Text = drv["Year"].ToString() + "年" + drv["Number"].ToString() + "号";
            }

        }

        //个人重大事项报告表
        protected void gvPersonImportantReport_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblReportDate = (Label)e.Row.Cells[2].FindControl("lblReportDate");

                string dateString = lblReportDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblReportDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //检务督察记录情况
        protected void gvJianWuDuCha_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblDate = (Label)e.Row.Cells[1].FindControl("lblDate");

                string dateString = lblDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //检风检纪记录情况
        protected void gvJianFengJianJi_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblDate = (Label)e.Row.Cells[1].FindControl("lblDate");

                string dateString = lblDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //违法违纪情况登记表
        protected void gvWeiFaWeiJi_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblDate = (Label)e.Row.Cells[1].FindControl("lblDate");

                string dateString = lblDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //领导干部收入申报表
        protected void gvLingDaoGanbuShouRu_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[2].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //检察干警配偶、子女从业情况申报登记表
        protected void gvJianChaGanbuPeiOuCongYe_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[1].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        //领导干部党风廉政建设检查评议登记表
        protected void gvLingDaoDangFengCheck_DataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[1].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);
            }

        }

        #endregion

        #region 绩效档

        //执法情况登记表
        protected void gvZhiFaQingKuangDengJi_DataBound(object sender, GridViewRowEventArgs e)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // load date format
                Label lblFillDate = (Label)e.Row.Cells[2].FindControl("lblFillDate");

                string dateString = lblFillDate.Text;
                DateTime dateTime = DateTime.Parse(dateString);
                lblFillDate.Text = dateTime.ToString(JCYConstant.Date_Format_CN);

                //load year and month
                LinkButton lbCaseYear = (LinkButton)e.Row.Cells[0].FindControl("lbCaseYear");
                lbCaseYear.Text = drv["FillYear"].ToString() + "年" + drv["FillMonth"].ToString() + "月";
            }

        }

        //量化考评得分表
        protected void gvLiangHuaStatistics_DataBound(object sender, GridViewRowEventArgs e)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

            }

        }

        #endregion

        #endregion

        #region Events

        protected void ImgBtnSearchProfile_Click(object sender, ImageClickEventArgs e)
        {
            var currentUserName = txtName.Text.Trim();

            #region 执法档

            //涉案款物处理情况
            using (LawCaseProxy LawCaseProxy = new LawCaseProxy())
            {
                var dtLawCaseMaterial = LawCaseProxy.GetLawCaseMaterial(0, currentUserName);
                if (dtLawCaseMaterial.Rows.Count > 0)
                {
                    this.gvLawCaseMaterial.DataSource = dtLawCaseMaterial;
                    this.gvLawCaseMaterial.DataBind();
                    this.lblLawCaseMaterialNoRecord.Visible = false;
                }
                else
                    this.lblLawCaseMaterialNoRecord.Visible = true;

                //安全办案基本情况
                var dtLawCaseSafety = LawCaseProxy.GetLawCaseSafety(0, currentUserName);
                if (dtLawCaseSafety.Rows.Count > 0)
                {
                    this.gvLawCaseSafety.DataSource = dtLawCaseSafety;
                    this.gvLawCaseSafety.DataBind();
                    this.lblLawCaseSafetyNoRecord.Visible = false;
                }
                else
                    this.lblLawCaseSafetyNoRecord.Visible = true;


            }

            #endregion

            #region 廉政档

            using (IncorruptProxy IncorruptProxy = new IncorruptProxy())
            {
                //《廉政准则》和《廉洁从检若干规定》对照检查表
                var dtLianZhengLianJieCheck = IncorruptProxy.GetLianZhengLianJieCheck(0, currentUserName);
                if (dtLianZhengLianJieCheck.Rows.Count > 0)
                {
                    this.gvLianjieLianZhengCheck.DataSource = dtLianZhengLianJieCheck;
                    this.gvLianjieLianZhengCheck.DataBind();
                    this.lblLianjieLianZhengCheckNoRecord.Visible = false;
                }
                else
                    this.lblLianjieLianZhengCheckNoRecord.Visible = true;

                //内部监督有关事项自查表（业务部门）
                var dtSelfControlBusiness = IncorruptProxy.GetSelfControlBusiness(0, currentUserName);
                if (dtSelfControlBusiness.Rows.Count > 0)
                {
                    this.gvSelfControlBusiness.DataSource = dtSelfControlBusiness;
                    this.gvSelfControlBusiness.DataBind();
                    this.lblSelfControlBusinessNoRecord.Visible = false;
                }
                else
                    this.lblSelfControlBusinessNoRecord.Visible = true;

                //内部监督有关事项自查表（综合部门）
                var dtSelfControlOverall = IncorruptProxy.GetSelfControlOverall(0, currentUserName);
                if (dtSelfControlOverall.Rows.Count > 0)
                {
                    this.gvSelfControlOverall.DataSource = dtSelfControlOverall;
                    this.gvSelfControlOverall.DataBind();
                    this.lblSelfControlOverallNoRecord.Visible = false;
                }
                else
                    this.lblSelfControlOverallNoRecord.Visible = true;

                //党员干部举办婚丧喜庆宴席审批表
                var dtStaffWedding = IncorruptProxy.GetStaffWeddingApproval(0, currentUserName);
                if (dtStaffWedding.Rows.Count > 0)
                {
                    this.gvStaffWedding.DataSource = dtStaffWedding;
                    this.gvStaffWedding.DataBind();
                    this.lblStaffWeddingNoRecord.Visible = false;
                }
                else
                    this.lblStaffWeddingNoRecord.Visible = true;

                //个人重大事项报告表
                var dtPersonImportantReport = IncorruptProxy.GetPersonImportantReport(0, currentUserName);
                if (dtPersonImportantReport.Rows.Count > 0)
                {
                    this.gvPersonImportantReport.DataSource = dtPersonImportantReport;
                    this.gvPersonImportantReport.DataBind();
                    this.lblPersonImportantReportNoRecord.Visible = false;
                }
                else
                    this.lblPersonImportantReportNoRecord.Visible = true;

                //检务督察记录情况
                var dtJianWuDuCha = IncorruptProxy.GetJianWuDuCha(0, string.Empty, null, null, currentUserName);
                if (dtJianWuDuCha.Rows.Count > 0)
                {
                    this.gvJianWuDuCha.DataSource = dtJianWuDuCha;
                    this.gvJianWuDuCha.DataBind();
                    this.lblJianWuDuChaNoRecord.Visible = false;
                }
                else
                    this.lblJianWuDuChaNoRecord.Visible = true;

                //检风检纪记录情况
                var dtJianFengJianJi = IncorruptProxy.GetJianFengJianJi(0, string.Empty, null, null, currentUserName);
                if (dtJianFengJianJi.Rows.Count > 0)
                {
                    this.gvJianFengJianJi.DataSource = dtJianFengJianJi;
                    this.gvJianFengJianJi.DataBind();
                    this.lblJianFengJianJiNoRecord.Visible = false;
                }
                else
                    this.lblJianFengJianJiNoRecord.Visible = true;

                //违法违纪情况登记表
                var dtWeiFaWeiJi = IncorruptProxy.GetWeiFaWeiJi(0, string.Empty, null, null, currentUserName);
                if (dtWeiFaWeiJi.Rows.Count > 0)
                {
                    this.gvWeiFaWeiJi.DataSource = dtWeiFaWeiJi;
                    this.gvWeiFaWeiJi.DataBind();
                    this.lblWeiFaWeiJiNoRecord.Visible = false;
                }
                else
                    this.lblWeiFaWeiJiNoRecord.Visible = true;

                //领导干部收入申报表
                var dtLingDaoSalary = IncorruptProxy.GetLingDaoSalary(0, currentUserName);
                if (dtLingDaoSalary.Rows.Count > 0)
                {
                    this.gvLingDaoGanbuShouRu.DataSource = dtLingDaoSalary;
                    this.gvLingDaoGanbuShouRu.DataBind();
                    this.lblLingDaoGanbuShouRuNoRecord.Visible = false;
                }
                else
                    this.lblLingDaoGanbuShouRuNoRecord.Visible = true;

                //检察干警配偶子女从业情况申报登记表
                var dtJianChaGanbuPeiOuCongYe = IncorruptProxy.GetJianChaGanbuPeiOuCongYe(0, currentUserName);
                if (dtJianChaGanbuPeiOuCongYe.Rows.Count > 0)
                {
                    this.gvJianChaGanbuPeiOuCongYe.DataSource = dtJianChaGanbuPeiOuCongYe;
                    this.gvJianChaGanbuPeiOuCongYe.DataBind();
                    this.lblJianChaGanbuPeiOuCongYeNoRecord.Visible = false;
                }
                else
                    this.lblJianChaGanbuPeiOuCongYeNoRecord.Visible = true;

                //领导干部党风廉政建设检查评议登记表
                var dtLingDaoDangFengCheck = IncorruptProxy.GetLingDaoDangFengCheck(0, currentUserName);
                if (dtLingDaoDangFengCheck.Rows.Count > 0)
                {
                    this.gvLingDaoDangFengCheck.DataSource = dtLingDaoDangFengCheck;
                    this.gvLingDaoDangFengCheck.DataBind();
                    this.lblLingDaoDangFengCheckNoRecord.Visible = false;
                }
                else
                    this.lblLingDaoDangFengCheckNoRecord.Visible = true;

            }

            #endregion

            #region 绩效档

            using (PerformanceCaseProxy PerformanceCaseProxy = new PerformanceCaseProxy())
            {
                //执法情况登记表
                var dtZhiFaQingKuangDengJi = PerformanceCaseProxy.GetPerformanceCase(0, currentUserName);
                if (dtZhiFaQingKuangDengJi.Rows.Count > 0)
                {
                    this.gvZhiFaQingKuangDengJi.DataSource = dtZhiFaQingKuangDengJi;
                    this.gvZhiFaQingKuangDengJi.DataBind();
                    this.lblZhiFaQingKuangDengJiNoRecord.Visible = false;
                }
                else
                    this.lblZhiFaQingKuangDengJiNoRecord.Visible = true;

                //量化考评得分表
                var dtLiangHuaStatistics = PerformanceCaseProxy.GetLiangHuaStatistics(0, DateTime.Now.Year.ToString(), string.Empty, currentUserName);
                if (dtLiangHuaStatistics.Rows.Count > 0)
                {
                    this.gvLiangHuaStatistics.DataSource = dtLiangHuaStatistics;
                    this.gvLiangHuaStatistics.DataBind();
                    this.lblLiangHuaStatisticsNoRecord.Visible = false;
                }
                else
                    this.lblLiangHuaStatisticsNoRecord.Visible = true;
            }

            #endregion

            #region 个况档

            CodeTable = GetPPSM2007CODEData();
            DataTable dtPropertyInfo = new DataTable();
            dtPropertyInfo.Columns.Add("UserName");
            dtPropertyInfo.Columns.Add("Income");
            dtPropertyInfo.Columns.Add("House");
            dtPropertyInfo.Columns.Add("Car");
            dtPropertyInfo.Columns.Add("CreateTime");

            SPListItemCollection spListItems = GetPropertyInfoList(currentUserName);
            if (spListItems.Count > 0)
            {
                foreach (SPListItem item in spListItems)
                {
                    DataRow dr = dtPropertyInfo.NewRow();
                    dr["UserName"] = item["干警姓名"].ToString();
                    dr["Income"] = item["收入来源情况"].ToString();
                    dr["House"] = item["房产情况"].ToString();
                    dr["CreateTime"] = item["填表日期"].ToString();
                    dr["Car"] = item["车辆等财产情况"].ToString();
                    dtPropertyInfo.Rows.Add(dr);
                }

                DataRow[] dtPropertyInfoRows = dtPropertyInfo.Select();
                this.dlPropertyInfo.DataSource = dtPropertyInfoRows;
                dlPropertyInfo.DataBind();
                this.SocialRelationPropertyRecordNoRecord.Visible = false;

            }
            else
            {
                this.SocialRelationPropertyRecordNoRecord.Visible = true;
                dlPropertyInfo.DataSource = null;
                dlPropertyInfo.DataBind();
            }


            var userInfo = GetUserInfoByName(currentUserName);
            if (userInfo.Rows.Count > 0)
            {
                this.SystemSearchResult.Visible = true;
                this.lbNoResultReturn.Visible = false;

            }
            else
            {
                this.lbNoResultReturn.Visible = true;
                this.SystemSearchResult.Visible = false;
                return;
            }
            //SelfResumeRecord
            DataRow[] rows = GetCareerByName(currentUserName).Select();
            dlJob.DataSource = rows;
            dlJob.DataBind();
            if (rows.Count() > 0)
            {

                SelfResumeRecordNoRecord.Visible = false;
            }

            else
                SelfResumeRecordNoRecord.Visible = true;
            //EducationAndTrainingRecord

            DataRow[] eduRows = GetEduInfoByName(currentUserName).Select();
            dlEduction.DataSource = eduRows;
            dlEduction.DataBind();
            if (eduRows.Count() > 0)
            {

                EducationAndTrainingRecordNoRecord.Visible = false;
            }

            else
                EducationAndTrainingRecordNoRecord.Visible = true;


            DataRow[] TrainRows = GetTrainInfoByName(currentUserName).Select();
            dlTrainingRecord.DataSource = TrainRows;
            dlTrainingRecord.DataBind();
            if (TrainRows.Count() > 0)
            {

                EducationAndTrainingRecordNoRecord.Visible = false;
            }

            else
                EducationAndTrainingRecordNoRecord.Visible = true;


            //SocialRelationPropertyRecord
            DataRow[] relationRows = GetRelationInfoByName(currentUserName).Select();
            dlSocialRelation.DataSource = relationRows;
            dlSocialRelation.DataBind();
            if (relationRows.Count() > 0)
            {

                SocialRelationPropertyRecordNoRecord.Visible = false;
            }

            else
                SocialRelationPropertyRecordNoRecord.Visible = true;

            //YearAssessmentRecord
            DataRow[] assessmentRows = GetAssessmentInfoByName(currentUserName).Select();
            dlYearAssessment.DataSource = assessmentRows;
            dlYearAssessment.DataBind();
            if (assessmentRows.Count() > 0)
            {

                YearAssessmentRecordNoRecord.Visible = false;
            }

            else
                YearAssessmentRecordNoRecord.Visible = true;

            #endregion

        }

        #endregion

    }
}
